package com.gz.spring.aop.homework;

import com.gz.spring.aop.homework.Aspectj.Cal;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class AspectTest {

    @Test
    public void testByAspect(){
        ApplicationContext ioc = new ClassPathXmlApplicationContext("homework01.xml");
        Cal cal = ioc.getBean(Cal.class);
        cal.cal1(10);
        System.out.println("==================");
        cal.cal2(5);
    }

    @Test
    public void testByXML(){
        ApplicationContext ioc = new ClassPathXmlApplicationContext("homework02.xml");
        com.gz.spring.aop.homework.xml方式.Cal cal = ioc.getBean(com.gz.spring.aop.homework.xml方式.Cal.class);
        cal.cal1(10);
        System.out.println("==================");
        cal.cal2(5);
    }
}
